package cn.zlb.frame.infrastructure.util.gateway.product;

import cn.zlb.frame.common.result.Result;
import cn.zlb.frame.common.result.ResultBuilder;
import cn.zlb.frame.domain.pay.model.entity.ProductEntity;
import cn.zlb.frame.domain.pay.respository.gateway.IProductGateway;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @author yangjie.deng@resico.cn
 * @date 2023-11-14 10:50:20
 * @describe class responsibility
 */
@Slf4j
@Service
public class ProductGateway implements IProductGateway {

    @Override
    public Result<Boolean> inventoryAbatement(ProductEntity entity) {
        log.info("库存扣减成功.本次扣减库存数量:{}", entity.getInventory());
        return ResultBuilder.success(Boolean.TRUE);
    }

    @Override
    public ProductEntity findProductByNo(String tenantNo, String productNo) {
        ProductEntity entity = new ProductEntity();
        entity.setTenantNo(tenantNo);
        entity.setProductNo("123");
        entity.setInventory(100);
        return entity;
    }
}
